<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
    <style>
        .parent {
            width: 400px;
            height: 400px;
            background-color: aqua;
        }

        .child {
            width: 300px;
            height: 300px;
            background-color: blueviolet;
        }
    </style>
</head>

<body>
    <div id="app">
        <!-- 阻止冒泡 -->
        <div class="parent" @click="log1">
            <div class="child" @click="log2"><button @click.stop="log3">按钮</button></div>
        </div>
        <!-- 添加捕获 -->
        <div class="parent" @click.capture="log1">
            <div class="child" @click="log2"><button @click="log3">按钮</button></div>
        </div>
        <!-- self -->
        <div class="parent" @click="log1">
            <div class="child" @click.self.stop="log2"><button @click="log3">按钮</button></div>
        </div>
        <!-- .once -->
        <div class="parent" @click="log1">
            <div class="child" @click="log2"><button @click.once="log3">按钮</button></div>
        </div>
        <!-- prevent -->
        <a href="https://www.baidu.com" @click.prevent="log"></a>
    </div>
</body>
<script>
    const vm = new Vue({
        el: '#app',
        data: {

        },
        methods: {
            log1() {
                console.log(1111);
            },
            log2() {
                console.log(2222);
            },
            log3() {
                console.log(3333);
            },
            log() {
                console.log('我是a标签');

            }
        }
    })
</script>

</html>